package org.openclinic.domain;

// Generated Nov 18, 2012 4:21:03 PM by Hibernate Tools 4.0.0

import java.util.Date;
import java.util.List;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * MedicalRecord generated by hbm2java
 */
@Entity
@Table(name = "medical_record", schema = "public")
public class MedicalRecord implements java.io.Serializable {

	private static final long serialVersionUID = -5027229675466639868L;
	
	private int recordId;
	
	private Appointment appointment;
	
	@Size(min = 50)
	private String description;
	
	@NotNull
	private Date creationDate;

	private List<Document> attests;
	private List<Document> prescribes;
	
	public MedicalRecord() {
		super();
	}

	public MedicalRecord(int recordId, Appointment appointment, String description, Date creationDate) {
		this.recordId = recordId;
		this.appointment = appointment;
		this.description = description;
		this.creationDate = creationDate;
	}

	public MedicalRecord(int recordId, Appointment appointment, String description, Date creationDate,
			Set<Document> documents) {
		this.recordId = recordId;
		this.appointment = appointment;
		this.description = description;
		this.creationDate = creationDate;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "record_id", unique = true, nullable = false)
	public int getRecordId() {
		return this.recordId;
	}

	public void setRecordId(int recordId) {
		this.recordId = recordId;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "appointment_id", nullable = false)
	public Appointment getAppointment() {
		return this.appointment;
	}

	public void setAppointment(Appointment appointment) {
		this.appointment = appointment;
	}

	@Column(name = "description", nullable = false, length = 2000)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "creation_date", nullable = false, length = 13)
	public Date getCreationDate() {
		return this.creationDate;
	}

	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

	@Transient
	public List<Document> getAttests() {
		return attests;
	}

	public void setAttests(List<Document> attests) {
		this.attests = attests;
	}

	@Transient
	public List<Document> getPrescribes() {
		return prescribes;
	}

	public void setPrescribes(List<Document> prescribes) {
		this.prescribes = prescribes;
	}
	
}
